'\" t
.\"     Title: drmHandleEvent
.\"    Author: David Herrmann <dh.herrmann@googlemail.com>
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: September 2012
.\"    Manual: Direct Rendering Manager
.\"    Source: libdrm
.\"  Language: English
.\"
.TH "DRMHANDLEEVENT" "3" "September 2012" "libdrm" "Direct Rendering Manager"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
drmHandleEvent \- read and process pending DRM events
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <xf86drm\&.h>
.fi
.ft
.HP \w'int\ drmHandleEvent('u
.BI "int drmHandleEvent(int\ " "fd" ", drmEventContextPtr\ " "evctx" ");"
.SH "DESCRIPTION"
.PP
\fBdrmHandleEvent\fR
processes outstanding DRM events on the DRM file\-descriptor passed as
\fIfd\fR\&. This function should be called after the DRM file\-descriptor has polled readable; it will read the events and use the passed\-in
\fIevctx\fR
structure to call function pointers with the parameters noted below:
.sp
.if n \{\
.RS 4
.\}
.nf
typedef struct _drmEventContext {
    int version;
    void (*vblank_handler) (int fd,
                            unsigned int sequence,
                            unsigned int tv_sec,
                            unsigned int tv_usec,
                            void *user_data)
    void (*page_flip_handler) (int fd,
                               unsigned int sequence,
                               unsigned int tv_sec,
                               unsigned int tv_usec,
                               void *user_data)
} drmEventContext, *drmEventContextPtr;
.fi
.if n \{\
.RE
.\}
.sp
.SH "RETURN VALUE"
.PP
\fBdrmHandleEvent\fR
returns
0
on success, or if there is no data to read from the file\-descriptor\&. Returns
\-1
if the read on the file\-descriptor fails or returns less than a full event record\&.
.SH "REPORTING BUGS"
.PP
Bugs in this function should be reported to https://bugs\&.freedesktop\&.org/enter_bug\&.cgi?product=DRI&component=libdrm under the "DRI" product, component "libdrm"
.SH "SEE ALSO"
.PP
\fBdrm\fR(7),
\fBdrm-kms\fR(7),
\fBdrmModePageFlip\fR(3),
\fBdrmWaitVBlank\fR(3)
